package cn.sylinx.horm.example.section12;

import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

import cn.sylinx.horm.resource.ClasspathSqlResource;
import cn.sylinx.horm.resource.parse.DefaultSqlParser;
import cn.sylinx.horm.resource.parse.SqlParser;
import cn.sylinx.horm.util.Pair;

@Profile("section12")
@Component
public class Section12 implements CommandLineRunner {

    public Section12() {
    }

    @Override
    public void run(String... args) throws Exception {
        test();
    }

    void test() {

        String sql = "horm/func/userDefindeFunc.sql";
        SqlParser sqlParser = new DefaultSqlParser();
        Pair p = sqlParser.parseSql(ClasspathSqlResource.apply(sql), null);

        System.out.println(p.getFirst().toString());
        System.out.println("-------------");

    }
}
